using System;
using UnityEngine;
using UnityEngine.UI;

namespace CGF
{
    //该脚本自动生成或覆盖，不可编辑
    public partial class PanelWithdrawEdit
    {   
		public ImagePro Dialog;
		public CButton BtnClose;
		public InputField InputName;
		public InputField InputAccount;
		public CButton BtnConfirm;
		public Image WayIcon;
		public Text WayName;
		public CButton BtnBankCode;
		public ScrollView VNBankDropdown;
		public Image InputPIX;
		public CButton BtnPixSelect;
		public InputField InputPIXAccount;
		public Dropdown PixDropdown;
		public I18N i18n;

        public Reference reference { get; private set; }
        public Action onProsBindCompleted;
        public bool isProsBindCompleted;
        
        public void BindProperties(Transform transform)
        {   
            reference = transform.GetComponent<Reference>();
            if(!reference)return;
            int nodeIndex = 0;
			Dialog = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<ImagePro>();
			BtnClose = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			InputName = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<InputField>();
			InputAccount = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<InputField>();
			BtnConfirm = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			WayIcon = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Image>();
			WayName = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			BtnBankCode = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			VNBankDropdown = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<ScrollView>();
			InputPIX = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Image>();
			BtnPixSelect = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			InputPIXAccount = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<InputField>();
			PixDropdown = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Dropdown>();
			i18n = transform.GetComponent<I18N>();
            isProsBindCompleted = true;
            onProsBindCompleted?.Invoke();
        }
        
        public void SetProsBindCompletedAction(Action action)
        {
            if (isProsBindCompleted)
            {
                action?.Invoke();
            }
            else
            {
                onProsBindCompleted = action;
            }
        }

		public string I18N_please_input_account { get { return i18n.GetTextByKey("please_input_account"); } }
		public string I18N_add_success { get { return i18n.GetTextByKey("add_success"); } }
    }
}
